[codex] Fix relative URL refs with path-only root ids#3084
Conversation
|
📚 Docs Preview: https://pr-3084.datamodel-code-generator.pages.dev |
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3084 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 87 87
Lines 18247 18633 +386
Branches 2087 2158 +71
==========================================
+ Hits 18247 18633 +386
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Superseded by #3085 due to branch and PR naming policy. |
Summary
$idvalues against the retrieval URL before using them as the base for relative$refresolution$idplusbase_url--urlinput with path-only$idand relative external$refRoot Cause
When a schema was fetched via
--urland declared a path-only root$idlike/schemas/v1/main.schema.json, that$idreplaced the retrieval URL as the reference base without first being normalized to an absolute URL. The next relative$refwas therefore resolved as a local filesystem path instead of remaining remote.Validation
tox -e typetox -e readmetox -e cli-docs -- --checktox -e config-types -- --checktox -e py314-parallel -- tests/test_reference.py tests/main/jsonschema/test_main_jsonschema.py -k 'relative_root_id or root_id_differs_from_base_url or url_with_relative_root_id_resolves_relative_refs or root_id_jsonschema_with_remote_file or remote_ref'tox -e py312-parallel -- tests/test_reference.py tests/main/jsonschema/test_main_jsonschema.py -k 'relative_root_id or root_id_differs_from_base_url or url_with_relative_root_id_resolves_relative_refs or root_id_jsonschema_with_remote_file or remote_ref'Fixes: #3080